package com.bolehui.web;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bolehui.base.result.Result;
import com.bolehui.domain.po.Jobpreference;
import com.bolehui.domain.vo.PreferenceVO;
import com.bolehui.service.JobpreferenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chendongjie
 * @since 2025-03-18
 */
@RestController
@RequestMapping("/jobpreference")
public class JobpreferenceController {

    @Autowired
    private JobpreferenceService jobpreferenceService;

    @RequestMapping(params = "action=save")
    public Result saveJobPrefer(@RequestBody PreferenceVO preferenceVO, @RequestParam Long userId){
       return jobpreferenceService.saveJobPr(preferenceVO, userId);
    }

    @RequestMapping(params = "action=list")
    public Result list(Long userId){
        return Result.success(jobpreferenceService.list(new QueryWrapper<Jobpreference>().eq("candidate_id", userId)));
    }

    @RequestMapping(params = "action=update")
    public Result update(@RequestBody PreferenceVO preferenceVO, Long userId){
        return jobpreferenceService.update(preferenceVO, userId);
    }
}

